home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-06
/
setser.zip
/
SETSERV.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-22
|
1KB
|
58 lines
/* SetServer ------------------------------------- */
/* Set the server time from the PC's time */
/* ----------------------------------------------- */
#include <dos.h>
#include <stdio.h>
#include <nit.h>
main()
{
struct date d;
struct time t;
int i; /* Temporary Counter */
int sconnect; /* Server Connection Numbers */
int pri_server; /* Current Primary Server */
int pre_server; /* Current Preferred Server */
char Sname[48]; /* File Server Name */
getdate(&d);
gettime(&t);
printf("Server Time Program. Copyright 1991 by\n");
printf("\tWhipple & Company\n");
printf("\t(317)469-7776\n\n");
printf("The current PC time is %2d/%02d/%4d %2d:%02d:%02d\n",
d.da_mon,d.da_day,d.da_year,
t.ti_hour, t.ti_min, t.ti_sec);
pri_server = GetPrimaryConnectionID();
pre_server = GetPreferredConnectionID();
for ( sconnect = 1; sconnect <= 8; sconnect++ ) {
if ( IsConnectionIDInUse(sconnect)) {
SetPrimaryConnectionID(sconnect);
SetPreferredConnectionID(sconnect);
GetFileServerName(sconnect,Sname);
printf("Setting time on %s ",Sname);
if (i = SetFileServerDateAndTime(d.da_year,d.da_mon,d.da_day,
t.ti_hour,t.ti_min,t.ti_sec)) {
if ( i == 198 )
printf("** Error: No Console Rights **");
else
printf("Unknown error: %x",i);
}
printf("\n");
}
}
SetPrimaryConnectionID(pri_server);
SetPreferredConnectionID(pre_server);
return 0;
}